package gui;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import logik.Buchverwaltung;
import logik.Einausgabekontrolle;
import model.Buch;
import model.Buchlistenobjekt;


/**
 * Servlet implementation class BuchdetailsServlet
 */
public class BuchdetailsServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BuchdetailsServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) 
    throws ServletException, IOException {
        //Dient nur zur Kontrolle
        String id = request.getParameter("id");
        int buchid = Integer.parseInt(id);
        System.out.println("Der Wert der Id ist :" + id);
        Buchverwaltung bv = new Buchverwaltung();
        Buch neuesBuch = bv.ladeBuch(buchid);
        request.setAttribute("buch", neuesBuch);
        getServletConfig().getServletContext().getRequestDispatcher(
        "/kommentieren.jsp").forward(request, response);
    }

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
